package cn.gson.zuche.controller.admin;

import java.io.IOException;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import cn.gson.zuche.model.bean.Userorder;
import cn.gson.zuche.model.dao.Userorderdao;

/**
 * Servlet implementation class iframeSeverlet
 */
@WebServlet("/iframe")
public class iframeSeverlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
	private Userorderdao dao=new Userorderdao();
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
	try {
		List<Userorder> syywc=new ArrayList<Userorder>();
		List<Userorder> wc=dao.selectwcdindanid("1");
		System.out.println(wc);
		for (int i = 0; i < wc.size(); i++) {	
		List<Userorder> ywc=dao.selectwcdindanmoney(wc.get(i).getOrderid());
		syywc.add(ywc.get(0));
		}
		
		List<Userorder> ytd=dao.selectdindan("3");
		List<Userorder> dfk=dao.selectdindan("4");
		List<Userorder> yfk=dao.selectdindan("5");
		List<Userorder> zlz=dao.selectdindan("6");
		request.setAttribute("ywc", syywc);
		request.setAttribute("ytd", ytd);
		request.setAttribute("dfk", dfk);
		request.setAttribute("yfk", yfk);
		request.setAttribute("zlz", zlz);
		request.setAttribute("ywcgs", syywc.size());
		request.setAttribute("ytdgs", ytd.size());
		request.setAttribute("dfkgs", dfk.size());
		request.setAttribute("yfkgs", yfk.size());
		request.setAttribute("zlzgs", zlz.size());
	} catch (SQLException e) {	
		e.printStackTrace();
	}
	request.getRequestDispatcher("/WEB-INF/jsp/adminjsp/jframe.jsp").forward(request, response);
	}

	
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		
		doGet(request, response);
	}

}
